package diagr.com;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;

public class SettingsScreen extends PreferenceActivity implements Preference.OnPreferenceChangeListener
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);        

        addPreferencesFromResource(R.xml.preferences);
        EditTextPreference Bspeed = (EditTextPreference)this.findPreference("pref_text_size");
        Bspeed.setSummary(Bspeed.getText());
        Bspeed.setOnPreferenceChangeListener(this);
        
        EditTextPreference Rspeed = (EditTextPreference)this.findPreference("pref_line_size");
        Rspeed.setSummary(Rspeed.getText());
        Rspeed.setOnPreferenceChangeListener(this);
        
        ListPreference Rcolor = (ListPreference)this.findPreference("pref_color_text");
        Rcolor.setSummary(Rcolor.getValue());
        Rcolor.setOnPreferenceChangeListener(this);
        
        ListPreference Rcolor_os = (ListPreference)this.findPreference("pref_color_os");
        Rcolor_os.setSummary(Rcolor_os.getValue());
        Rcolor_os.setOnPreferenceChangeListener(this);
        
    }

    public boolean onPreferenceChange(Preference preference, Object newValue)
    {
        preference.setSummary((CharSequence)newValue);

        return true;
    }
}